<template>
	<view class="page">
		<u-navbar leftIconSize='30rpx' border title="充值订单" @leftClick="$utils.back()" :placeholder="true">
		</u-navbar>
		<view style="flex: 1;">
			<z-paging ref="paging" :fixed="false" v-model="data" @query="query" :default-page-no="1"
				:default-page-size="10" style="height: 100%;box-sizing: border-box;padding-top: 10rpx;" scroll-y="true">
				<view v-for="item in data" :key="item.id" class="contentBox viewWidth flex">
					<u-avatar :src='item.user.avatar' size='100rpx' />
					<view class="flex">
						<view>
							<u-text :lines='1' size='24rpx' :text='item.user.nick_name' />
						</view>
						<view>
							{{item.created_at | dateFormat}}
						</view>
					</view>
					<view :style="{color:item.balance>0?'green':'red'}">
						￥：<text v-if="item.balance>0">+</text>{{item.balance}}
					</view>
				</view>
			</z-paging>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				disabled: false,
				data: [],
				loading: true,
				id: 0
			}
		},
		methods: {
			query(pageNo, pageSize) {
				let sendData = {
					page: pageNo,
					size: pageSize,
				}
				uni.showLoading({
					title: '加载中...'
				})
				this.$api.Shop.Recharge(sendData).then(res => {
					uni.hideLoading();
					this.$refs.paging.complete(res.data.transfers.data);
					this.loading = false

				}).catch(err => uni.hideLoading())
			},
		}
	}
</script>

<style scoped lang="scss">
	.page {
		display: flex;
		flex-direction: column;
		height: 100vh;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
		box-sizing: border-box;
	}

	.contentBox {
		border-radius: 8rpx;
		margin-top: 20rpx;
		box-sizing: border-box;
		align-items: center;
		padding-bottom: 10rpx;
		border-bottom: 1rpx solid #f5f5f5;

		>view:nth-child(2) {
			flex-direction: column;
			flex: 1;
			margin: 0 10rpx;
			justify-content: space-between;
			height: 100rpx;
		}
	}

	.flex {
		display: flex;
	}



	image {
		width: 150rpx;
		height: 150rpx;
		border-radius: 8rpx;
	}
</style>